/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.data.provider.shp;

import chunmap.model.geom.GeometryType;

/**
 * @author chunquedong
 * 
 */
public class ShapefileType {
	public static final int Null = 0;
	public static final int Point = 1;
	public static final int PolyLine = 3;
	public static final int Polygon = 5;
	public static final int Multipoint = 8;
	public static final int PointZ = 11;
	public static final int PolyLineZ = 13;
	public static final int PolygonZ = 15;
	public static final int MultiPointZ = 18;
	public static final int PointM = 21;
	public static final int PolyLineM = 23;
	public static final int PolygonM = 25;
	public static final int MultiPointM = 28;
	public static final int MultiPatch = 31;

	public static GeometryType getShapeType(int shapefileType) {
		switch (shapefileType) {
		case ShapefileType.Null:
			return GeometryType.None;

		case ShapefileType.Point:
		case ShapefileType.PointM:
		case ShapefileType.PointZ:
			return GeometryType.Point;

		case ShapefileType.Multipoint:
		case ShapefileType.MultiPointM:
		case ShapefileType.MultiPointZ:
			return GeometryType.MultiPoint;

		case ShapefileType.PolyLine:
		case ShapefileType.PolyLineM:
		case ShapefileType.PolyLineZ:
			return GeometryType.MultiLineString;

		case ShapefileType.Polygon:
		case ShapefileType.PolygonM:
		case ShapefileType.PolygonZ:
			return GeometryType.MultiPolygon;

		default:
			throw new UnsupportedOperationException(
					"this ShapefileType is unsupported");

		}
	}
}